//package com.thinksns.sociax.t4.android.fragment;
//
//import android.graphics.drawable.ColorDrawable;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.View;
//import android.widget.AdapterView;
//import android.widget.ListView;
//import android.widget.Toast;
//
//import com.scwang.smartrefresh.layout.SmartRefreshLayout;
//import com.scwang.smartrefresh.layout.api.RefreshLayout;
//import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener;
//import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
//import com.thinksns.sociax.android.R;
//import com.thinksns.sociax.t4.adapter.AdapterSociaxList;
//import com.thinksns.sociax.t4.android.weiba.ActivityPostDetail;
//import com.thinksns.sociax.t4.model.ModelPost;
//import com.thinksns.sociax.thinksnsbase.activity.widget.EmptyLayout;
//import com.thinksns.sociax.thinksnsbase.bean.ListData;
//import com.thinksns.sociax.thinksnsbase.bean.SociaxItem;
//import com.thinksns.sociax.thinksnsbase.utils.ActivityStack;
//
//
///**
// * 类说明：  精华帖，需要传入intent weiba_id
// * @author  wz
// * @date    2014-12-26
// * @version 1.0
// */
//public class FragmentPostDigest extends FragmentPostList implements
//		AdapterView.OnItemClickListener,OnRefreshListener,OnLoadmoreListener{
//	private int weiba_id = -1;
//	private SmartRefreshLayout smartRefreshLayout;
//	private EmptyLayout emptyLayout;
//
//	@Override
//	public void initView() {
//		smartRefreshLayout = (SmartRefreshLayout) findViewById(R.id.smart_refresh_layout);
//		listView = (ListView) findViewById(R.id.pull_refresh_list);
//		listView.setBackgroundColor(getResources().getColor(R.color.bg_ios));
//		listView.setDivider(new ColorDrawable(getResources().getColor(R.color.bg_listview_divider)));
//		listView.setDividerHeight(1);
//		listView.setSelector(R.drawable.list_selector);
//
//		emptyLayout = (EmptyLayout)findViewById(R.id.empty_layout);
//		emptyLayout.setVisibility(View.GONE); // 隐藏，他的加载中是写在adapter里的
////		emptyLayout.setNoDataContent(getResources().getString(R.string.empty_content));
//
//		list = new ListData<SociaxItem>();
//		adapter = new AdapterPostDigestList(this, list, weiba_id);
//		listView.setAdapter(adapter);
//		listView.setOnItemClickListener(this);
//	}
//
//	@Override
//	public void initIntentData() {
//		weiba_id = getActivity().getIntent().getIntExtra("weiba_id", -1);
//		if(weiba_id == -1){
//			Log.e("FragmentPostDigest", "FragmentWeibaDigest needs intent weiba_id");
//		}
//	}
//
//	@Override
//	public void initListener() {
//		smartRefreshLayout.setOnRefreshListener(this);
//		smartRefreshLayout.setOnLoadmoreListener(this);
////		emptyLayout.setOnLayoutClickListener(new View.OnClickListener() {
////			@Override
////			public void onClick(View v) {
////
////			}
////		});
//	}
//
//
//	@Override
//	public void initData() {
//		adapter.loadInitData();
//	}
//
//	@Override
//	public int getLayoutId() {
//		return R.layout.fragment_common_post_list;
//	}
//
//	@Override
//	public void executeDataSuccess(ListData<SociaxItem> list) {
//		if(list.size() < AdapterSociaxList.PAGE_COUNT) {
//			smartRefreshLayout.setEnableLoadmore(false);
//			if(adapter.getRefreshState() == AdapterSociaxList.REFRESH_FOOTER) {
//				Toast.makeText(getActivity(), "没有更多了", Toast.LENGTH_SHORT).show();
//			}
//		}else {
//
//		}
//
//		super.executeDataSuccess(list);
//	}
//
//	@Override
//	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//		if (id < 0){
//			return;
//		}
//		ModelPost post = (ModelPost) adapter.getItem((int)id);
//		if (post != null && post.getUser() != null) {
//			Bundle data = new Bundle();
//			data.putParcelable("post", post);
//			ActivityStack.startActivity(getActivity(), ActivityPostDetail.class, data);
//		}
//	}
//
//	@Override
//	public void onLoadmore(RefreshLayout refreshlayout) {
//		if (adapter != null) {
//			adapter.doRefreshFooter();
//		}
//	}
//
//	@Override
//	public void onRefresh(RefreshLayout refreshlayout) {
//		if (adapter != null) {
//			adapter.doRefreshHeader();
//		}
//	}
//}
